package cn.liyao.web.model;

import cn.liyao.web.converter.BooleanYNConverter;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;

@Entity
@Data
@Table(name = "t_conversation")
public class Conversation {

    @Id
    @Column(columnDefinition = "VARCHAR(64)")
    private String id;

    // 现在以群组ID或者 用户ID为主
    @Column(columnDefinition = "VARCHAR(64)")
    private String targetId;

    // 所属用户
    @Column(columnDefinition = "VARCHAR(64)")
    private String userId;

    @Column(name = "conversation_type")
    private Integer type;

    private String userName;

    private String portrait;

    @Column(columnDefinition = "TEXT")
    private String lastMessage;

    @Convert(converter = BooleanYNConverter.class)
    private Boolean top;


    // 消息免打扰
    @Convert(converter = BooleanYNConverter.class)
    private Boolean disturb;

    @Column(name = "unread_count", columnDefinition = "INT DEFAULT 0")
    private Integer unreadCount;


    private Long timestamp;



    // 备注 仅是我对群里面备注
    private String remark;

    // 群公告
    private String notice;

}
